/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.cservice;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;

public final class b {
    private LinkedList a;
    private int b = 0;

    public b(int paramInt) {
        this.b = ((paramInt > 0) ? paramInt : 0);
        this.a = new LinkedList();
    }

    public void a(List paramList) {
        if ((paramList == null) || (paramList.isEmpty()) || (this.a == null))
            return;
        for (int i = paramList.size() - 1; i >= 0; --i)
            this.a.addFirst(paramList.get(i));
        i = this.a.size() - this.b;
        for (int j = 0; j < i; ++j)
            this.a.removeLast();
    }

    public void b(List paramList) {
        if ((paramList == null) || (paramList.isEmpty()) || (this.a == null))
            return;
        Iterator localIterator = paramList.iterator();
        while (localIterator.hasNext()) {
            Object localObject = localIterator.next();
            this.a.addLast(localObject);
        }
        int i = this.a.size() - this.b;
        for (int j = 0; j < i; ++j)
            this.a.removeFirst();
    }

    public Object[] a() {
        return this.a.toArray();
    }

    public void b() {
        this.a.clear();
    }

    public Object c() {
        Object localObject = null;
        try {
            localObject = this.a.getFirst();
        } catch (NoSuchElementException localNoSuchElementException) {}
        return localObject;
    }

    public Object d() {
        Object localObject = null;
        try {
            localObject = this.a.getLast();
        } catch (NoSuchElementException localNoSuchElementException) {}
        return localObject;
    }
}